package com.yyb.utils.neteaseim.api.impl;

import com.jiuqian.xdpx.aid.neteaseim.api.NeImHistoryMessageService;
import com.jiuqian.xdpx.aid.neteaseim.bean.reseponse.NeImHistoryMessageResponse;
import com.jiuqian.xdpx.aid.neteaseim.bean.query.NeImSingleHistoryMessageQuery;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

/**
 * @Author : Marshal
 * @Create : 2018/3/28 11:06
 * @Description : DOO
 */
@Service
public class NeImHistoryMessageServiceImpl extends NeImBaseServiceImpl implements NeImHistoryMessageService {

    @Override
    public NeImHistoryMessageResponse querySingleHistoryMsg(NeImSingleHistoryMessageQuery query) {
        MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
        params.add("form", query.getFrom());
        params.add("to", query.getTo());
        params.add("begintime", query.getBegintime());
        params.add("limit", Integer.toString(query.getLimit()));
        params.add("reverse", Integer.toString(query.getReverse()));
        NeImHistoryMessageResponse bean = super.build(params, SINGLE_HISTORY_MSG, NeImHistoryMessageResponse.class);
        return bean;
    }
}

